/*
 * AgentInfoListItem.java
 * business
 *
 * Created by SunDing on 2016/9/9.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.listview.displaylistitem;

import android.app.Activity;
import android.content.Context;
import android.view.View;

import com.yidiandao.business.R;
import com.yidiandao.business.data.bean.Goods;
import com.yidiandao.business.ui.goodsdetail.GoodsDetailActivity;
import com.yidiandao.business.ui.widget.listview.DisplayListItem;
import com.yidiandao.business.ui.widget.listview.viewholder.AgentInfoHolder;
import com.yidiandao.business.utils.ImageLoader;
import com.yidiandao.business.utils.UmengUtils;

/** 我是代理商 内容 */
public class AgentInfoListItem extends DisplayListItem<AgentInfoHolder, Goods> {

    public AgentInfoListItem(Goods s) {
        super(s);
    }

    @Override
    public void onShow(final Context context, AgentInfoHolder holder) {

        ImageLoader.loadImage(context, holder.mIvAgentSingleLogo, data.getGoodsThumb());

        holder.mIvAgentSingleName.setText(data.getGoodsName());
        holder.mTvAgentSingleMarketPrice.setText(data.getShopPrice());
        holder.mTvAgentSingleDeliveryPrice.setText(data.getAgentPrice());
        holder.mTvAgentLevel.setText(data.getAgentGrade());

        holder.mLlAgentInfoItem.setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        UmengUtils.onEvent(context, R.string.umeng_agents_goods_detail);
                        Activity activity = (Activity) context;
                        GoodsDetailActivity.actionStart(activity, data.getGoodsId());
                    }
                });
    }

    @Override
    public String getDisplayItemTag() {
        return AgentInfoListItem.class.getSimpleName();
    }

    @Override
    public Class<AgentInfoHolder> getViewHolderClazz() {
        return AgentInfoHolder.class;
    }
}
